package com.taylover.demo01.task;

import com.apifan.common.random.source.*;
import com.taylover.demo01.entity.User;
import org.apache.commons.lang3.time.DateUtils;

import java.text.ParseException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

/**
 * @author xyzZero3
 * @date 2025/3/26 21:39
 */
public class AddDataTask {

    public static void main(String[] args) {
        addUser();
    }

    public static void addUser() {

    }

    private static List<User> createUser() throws ParseException {
        LocalDateTime startTime = LocalDateTime.now();

        List<User> userList = new ArrayList<>();

        LocalDate beginDate = LocalDate.of(2000,1,1);
        LocalDate endDate = LocalDate.of(2024,12,31);
        for (int i = 0; i < 100000; i++) {
            String userId = UUID.randomUUID().toString().replace("-", "");
            String username = PersonInfoSource.getInstance().randomEnglishName();
            String password = PersonInfoSource.getInstance().randomStrongPassword(16, false);
            String email = InternetSource.getInstance().randomEmail(15);
            String firstName = OtherSource.getInstance().randomChinese();
            String lastName = OtherSource.getInstance().randomChinese(2);
            String country = AreaSource.getInstance().randomCountryOrRegionCode().getNameCN();
            String signature = OtherSource.getInstance().randomChineseSentence();
            String birth = DateTimeSource.getInstance().randomDate(beginDate, endDate, "yyyy-MM-dd");


            User user = new User(userId, username, password, email, firstName, lastName, country, signature, DateUtils.parseDate(birth, "yyyy-MM-dd"));
            userList.add(user);
        }
        LocalDateTime endTime = LocalDateTime.now();
        System.out.println("开始时间：" + startTime);
        System.out.println("结束时间：" + endTime);
        return userList;
    }

}
